<%-- 
    Document   : showlistmonan
    Created on : Nov 20, 2011, 9:06:33 PM
    Author     : Venus
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.*,  Beans.ThamSoHT,Models.ThamSoHT_Model"%>
<%            
            Vector vDSMA = (Vector) request.getAttribute("DSMA");
            int numpage = 0;// khởi tạo số trang = 0
            int vsize = vDSMA.size();
            if (vsize % 10 == 0) // mỗi trang có 6 dòng
            {
                numpage = vsize / 10;
            } else {
                numpage = vsize / 10 + 1;
            }
            String xx = (String) request.getAttribute("item"); 
            int item = Integer.parseInt(xx);
            String MaNMA = (String) request.getAttribute("manma");
            int total = 0;
%>
<%
    for (int j = (item - 1) * 10; j < (item - 1) * 10 + 10 && j < vsize; j++){
        Beans.MonAn ma = (Beans.MonAn) vDSMA.elementAt(j);%>
        <% total = total + 1; %>
        <div style=" width: 30px; float: left;"><input type="checkbox" name="chkma" alt="<%=ma.getMaMA() %>"></div>        
        <div><%=ma.getTenMA() %></div><br />
<%  }%>
<input type="hidden" name="total" value="<%=total%>">
<div class="pagination" style=" margin-right: 20px;">
    <%
        int trang = 1;
        if (item > 1) {
            trang = item - 1;
        }
    %>
    <%
        if (vsize > 10) {%>
            <a href="#" class="prev"  name="<%= trang%>" lang="<%=MaNMA %>" onclick="ShowListFood( this.name, this.lang)">«</a>
    <%      for (int c = 1; c <= numpage; c++) {
                if (c != item) {
    %>              <a href="#"  name="<%= c%>" lang="<%=MaNMA %>" onclick="ShowListFood( this.name, this.lang)" ><%= c%></a>
    <%          } else {%><a class="current"> <%= c%></a> <% }
            }
    %>
    <%      if (item + 1 <= numpage) {
                trang = item + 1;
            } else {
                trang = item;
            }
    %>
            <a href="#" class="next"  name="<%= trang%>" lang="<%=MaNMA %>" onclick="ShowListFood( this.name, this.lang)">»</a>
    <%  }
    %>
</div>